package mortal.game.control
{
    import modules.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.model.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class MsgTipControl extends Controller
    {
        private var msgTipModule:MsgTipModule;

        public function MsgTipControl()
        {
            
        }

        override protected function initView() : IView
        {
            if (this.msgTipModule == null)
            {
                this.msgTipModule = new MsgTipModule();
                this.msgTipModule.layer = LayerManager.msgTipLayer;
            }
            return this.msgTipModule;
        }

        override protected function initServer() : void
        {
            Dispatcher.addEventListener(EventName.MsgTipDateChange, this.msgTipDataChange);
            
        }

        private function msgTipDataChange(event:DataEvent) : void
        {
            var _loc_3:Array = null;
            var _loc_4:MsgTipInfo = null;
            var _loc_2:* = event.data;
            if (_view == null)
            {
                this.initView();
            }
            if (this.msgTipModule.isHide)
            {
                if (_loc_2 is String)
                {
                    _loc_3 = [_loc_2];
                    this.msgTipModule.isClick = 0;
                    this.msgTipModule.notTipEvent = "";
                    this.msgTipModule.isAutoHide = true;
                    this.msgTipModule.setContentTxt(_loc_3);
                }
                else if (_loc_2 is MsgTipInfo)
                {
                    _loc_4 = _loc_2 as MsgTipInfo;
                    this.msgTipModule.isClick = _loc_4.isClick;
                    this.msgTipModule.notTipEvent = _loc_4.notTipEvent;
                    this.msgTipModule.isMultiLink = _loc_4.isMultiLink;
                    this.msgTipModule.isAutoHide = _loc_4.isAutoHide;
                    this.msgTipModule.setContentTxt(_loc_4.contentArr, _loc_4.clickEventArr, _loc_4.colorArr, _loc_4.itemColorArr, _loc_4.itemDataArr, _loc_4.isItemLinkArr, _loc_4.isItemNewLineArr);
                }
                this.msgTipModule.show();
            }
            
        }

        public function stageResize() : void
        {
            if (this.msgTipModule != null)
            {
                this.msgTipModule.stageResize();
            }
            
        }

    }
}
